<?php include('functions.php'); ?>
<html>
<head>
<title>oPanel V<?php echo $ver; ?></title>
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet"href="style.css">
</head>
<body>
<center><img src="images/logo.png"></center>
<?php
/*****[BEGIN]******************************************
 [ Base:     oPanel Security                   v2.0.0 ]
 ******************************************************/
if ($_SESSION["pass"] != check($_SESSION["user"])) {
  secure();
}
/*****[END]********************************************
 [ Base:     oPanel Security                   v2.0.0 ]
 ******************************************************/
if(isset($_GET['file'])) {
$file = $_GET['file']; // get just the file name
} if(isset($_GET['dir'])) {
$dir = $_GET['dir']; // lets find the file we are talking about
}
if($debug != 'true') {
$config_test = realpath("./config.php");
$oPanel_dir = dirname("$config_test");
if ($dir == $oPanel_dir) {
echo "<font class=med><img src=\"images/i-regular.gif\">
<b><font size=+1>".$file."</font></b>
<br>File Type: PHP script text
<br><br>
<font color=\"red\">
You can't edit oPanel Files!";
exit;
}
}
if(!isset($_POST['newname'])) {
if(isset($file)) {
echo "<b>Rename $file in<br>";
echo "<i>$dir</i> to</b>";
echo '<form method="POST" action="rename.php" >
<input type="text" name="newname">
<input type="submit" value="Rename">';
echo "<input type=\"hidden\" name=\"dir\" value=\"$dir\">";
echo "<input type=\"hidden\" name=\"name\" value=\"$file\"></form>";
} else {
echo "<b>Rename " .basename($dir). " in<br>";
echo "<i>" .dirname($dir). "/</i> to</b>";
echo '<form method="POST" action="rename.php" >
<input type="text" name="newname">
<input type="submit" value="Rename">';
echo "<input type=\"hidden\" name=\"dir\" value=\"" .dirname($dir). "/\">";
echo "<input type=\"hidden\" name=\"name\" value=\"" .basename($dir). "\"></form>";
}
} else {
$newname = $_POST['newname']; // the new files name
$dir = $_POST['dir'];
$old = $_POST['name']; // the old file name
$oldfile = "$dir$old";
$newfile = "$dir$newname";
rename("$oldfile", "$newfile");
echo "<b>Renamed $old -> $newname in</b>";
echo "<br><i>$dir</i>";
?>
<script type="text/javascript">
parent.filemain.location="http://<?php echo $_SERVER["HTTP_HOST"]; echo dirname("$_SERVER[SCRIPT_NAME]"); ?>/list.php?dir=<?php echo $dir; ?>";
</script>
<?php } ?>
</font> 
</body>
</html>